package com.linxianqin.springbootVue.domain.convert;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.linxianqin.springbootVue.domain.dto.SysPostDTO;
import com.linxianqin.springbootVue.domain.entity.SysPost;
import com.linxianqin.springbootVue.domain.vo.SysPostExcel;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface SysPostConvert {
    SysPostConvert INSTANCE = Mappers.getMapper(SysPostConvert.class);

    SysPostDTO entity2dto(SysPost postDTO);
    List<SysPostDTO> entity2dto(List<SysPost> postDTO);

    SysPost dto2entity(SysPostDTO postDTO);

    @Mappings({
            @Mapping(target = "ascs",ignore = true),
            @Mapping(target = "asc",ignore = true),
            @Mapping(target = "descs",ignore = true),
            @Mapping(target = "desc",ignore = true),
    })
    Page<SysPostDTO> entity2dto(Page<SysPost> page);

    @Mappings({
            @Mapping(target = "ascs",ignore = true),
            @Mapping(target = "asc",ignore = true),
            @Mapping(target = "descs",ignore = true),
            @Mapping(target = "desc",ignore = true),
    })
    Page<SysPost> dto2entity(Page<SysPostDTO> page);

//    List<SysPostExcel> entity2Excel(List<SysPost> list);
}
